<?php
class Login extends Eva{

    function Login(){
         parent::Eva();
         $this->database();
         $this->lib("message");
         
    }
    
    function index(){
    	
    	 $article_list = $this->db->find("select * from article order by created desc limit 0,7");
    	 $data = array(
    	 'article_list'=>$article_list
    	 );
    	 
         $this->view("manage/login",$data);
    }
    function verify(){
         extract($_POST);
         
         /**
          * 
          * @var Login
          * 读取的新闻列表
          * 
          */
         $article_list = $this->db->find("select * from article order by created desc limit 0,7");
    	 $data = array(
    	 'article_list'=>$article_list
    	 );
    	 
    	 
    	 /**
    	  * 
    	  * 提取用户名
    	  * @var unknown_type
    	  */
         $manager = $this->db->find_row("select * from manager  where name= '$name' ");
         $pw = md5($name.$pw);
         echo $pw;
         if(!empty($manager) && $manager['pw'] == $pw){
            $data = array(
				'manager_id' => $manager['id'],
				'manager_name' => $manager['name']
			);
			$this->session->set_userdata( $data );
			$this->view("manage/today");
         }
         else{
            $this->message->set("<span style='color:red;'>用户名或密码错误</span>");
			$this->view('manage/login',$data);
         }
        
    }
    
    
}